{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 下采样 - 信号相位\n",
    "此示例说明如何使用downsample获得信号的相位。以M为因子对信号下采样可以产生M个唯一相位。例如，如果您有一个离散时间信号x，它具有x(0)、x(1)、x(2)、x(3)、...等，则x的M个相位是 x(nM + k)，其中 k = 0,1, ..., M-1。\n",
    "这M个信号称为x的多相分量。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "创建一个白噪声向量，并以3为因子下采样以得到3个多相分量。\n",
    "将随机数生成器重置为默认设置，以产生可重复的结果。生成一个白噪声随机向量，并以3为因子下采样以得到3个多相分量。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import math\n",
    "import scipy.signal\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "降采样函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {},
   "outputs": [],
   "source": [
    "def downsample(data,rate,phase):\n",
    "    newdata = np.zeros(math.floor(len(data)/rate))\n",
    "\n",
    "    for i in range(0,math.floor(len(data)/rate)):\n",
    "\n",
    "        newdata[i] = data[i*rate+phase]\n",
    "    return newdata\n",
    "\n",
    "    \n",
    "def upsample(data,rate,phase):\n",
    "    newdata = np.zeros(len(data)*rate+phase)\n",
    "\n",
    "    for i in range(0,len(data)):\n",
    "        newdata[i*rate+phase] = data[i]\n",
    "    return newdata"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "多相分量的长度等于原始信号的 1/3。\n",
    "使用 upsample 对多相分量进行以 3 为因子的上采样。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.random.randn(36)\n",
    "x0 = downsample(x,3,0)\n",
    "x1 = downsample(x,3,1)\n",
    "x2 = downsample(x,3,2)\n",
    "y0 = upsample(x0,3,0)\n",
    "y1 = upsample(x1,3,1)\n",
    "y2 = upsample(x2,3,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "绘制结果。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'Phase2')"
      ]
     },
     "execution_count": 75,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEICAYAAABxiqLiAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAmWklEQVR4nO3df7xcdX3n8de7IQQqQcVEgyRwiVAxIiBNo6nWYv1BpCh1C0ptFVEL0tLVVdeGUGlk1+0Du5V1xS0EsChCG3+AIA+shIo/2IbgDb/CD5HwowvZKAHFBLVg9L1/nHNlvDszd+7cmXvOzH0/H4887sw53znnPedm5nPPr+9XtomIiJisX6s6QEREDKYUkIiI6EoKSEREdCUFJCIiupICEhERXUkBiYiIrqSAxIwlaZWkC3rdtoNlWdIBXbzudyTd3YsME6xnpMy4S7/XFYNNuQ8khoGktwPvB54HbAcuB06z/ViFsZqSZOBA25ubzHshcDawlOIPvHuBD9m+ehrzjQD3A7Nt75yu9cbgyR5IDDxJ7wfOAv4z8HTgpcB+wDpJu7Z4TV3/uv4ysA5YADwb+I8UBTGidlJAYqBJ2hP4MPAXtv/Z9s9sPwC8CRgB/qRst1rSFyR9VtJ24O3ltM82LOttkv5N0qOSPiTpAUmvbnj9Z8vHY4d4TpD0fyQ9Iun0huUsk7Re0mOStko6p1UhG/de5gH7A+fbfrL8979tX1/OP0LSQw3tD5d0s6Qdkj4vaa2k/9rYVtL7JT1c5jix4bW/X752u6QHJa3u8lcQM1gKSAy63wZ2Ay5rnGj7ceBq4DU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kvQHKnw9XnKcp298vP7i/AM6nBttU0myKL+VLbF9WTq7d9myWs47bc4ztx4DrgOXAMySNDUtRq898Q84V5aFC234C+Aeq354vA94g6QGKw/2/B3ycSW7PYSog3wYOLK8i2BU4Hriy4kz/Hw1eN/VXAieUj08ArqgwS0tjX8qlN1LxNi2PJ18I3GX7Yw2zarU9W+Ws4facL+kZ5ePdgddQnK+5jqeGxK7D9myW8zsNfzSI4rxCpdvT9mm2F9oeofiu/JrtP2ay27PqqwB6fEXBURRXkdxLMfJh5ZmaZFxMcYXYrcAddcoJ/CPF4YqfURz/fCfFcdF/Ae4BrgX2qmnOi4FNwG0UX9J7V5zx5RSHp24Dbin/HVW37dkmZ9225yHAzWWe24EzyumLgRuBzcDngTk1zfm1cnveDnyW8kqtOvwDjuCpq7AmtT3TlUlERHRlmA5hRUTENEoBiYiIrqSAREREV1JAIiKiKykgERHRlRSQiIjoSgpIRER05f8B5lcdaCb35iUAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 4 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.subplot(411)\n",
    "plt.stem(x,markerfmt=' ')\n",
    "plt.axis([0,40,-3,3])\n",
    "plt.title('Original Signal')\n",
    "plt.subplot(412)\n",
    "plt.stem(y0,markerfmt=' ')\n",
    "plt.axis([0,40,-3,3])\n",
    "plt.ylabel('Phase0')\n",
    "plt.subplot(413)\n",
    "plt.stem(y1,markerfmt=' ')\n",
    "plt.axis([0,40,-3,3])\n",
    "plt.ylabel('Phase1')\n",
    "plt.subplot(414)\n",
    "plt.stem(y2,markerfmt=' ')\n",
    "plt.axis([0,40,-3,3])\n",
    "plt.ylabel('Phase2')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果对上采样的多相分量求和，就可以得到原始信号。\n",
    "\n",
    "创建离散时间正弦信号，并以 2 为因子下采样以得到 2 个多相分量。\n",
    "\n",
    "创建角频率为 $\\pi/4$ 弧度/采样点的离散时间正弦波。将值为 2 的 DC 偏移量加到正弦波上，以帮助进行多相分量的可视化。对正弦波以 2 为因子下采样，以获得偶数和奇数多相分量。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {},
   "outputs": [],
   "source": [
    "n = np.linspace(0,127,128)\n",
    "x = 2 + np.cos(np.pi/4*n)\n",
    "x0 = downsample(x,2,0)\n",
    "x1 = downsample(x,2,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "对两个多相分量进行上采样。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "y0 = upsample(x0,2,0)\n",
    "y1 = upsample(x1,2,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "绘制上采样后的多相分量和原始信号以进行比较。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'Phase1')"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXgAAAEICAYAAABVv+9nAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAb8klEQVR4nO3df5RcdZ3m8fdjEiWAEjARMQE6DlncEEHYHIRhxnFQjokyE9dxBNbxF5xBZ5gRPOx6QEaPsDt7jusP1F1Fwg8TFAEJqMgRNbIIw04IJoghEpAIKrDBBDUk6GxC5Nk/7m2sdLq7Kt11+1bdPK9z6nTdW3W/9+lvdX/69rdufa9sExERzfO8ugNEREQ1UuAjIhoqBT4ioqFS4CMiGioFPiKioVLgIyIaKgU++o6kD0m6vNvP7aAtSzpsDNv9qaQHu5GhzX4G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UR4mzgZcB+7Dr8EFf6dW+7oSkCyiGW6+uO8to+r3APw4c3LI8q1zX0yRNoSjuV9u+sVz9y8F/ScuvG+vKN4oTgL+U9DOK4bATKca0p5XDBtDbr8FjwGO2V5bLyygKfj/0/euBR2xvsv0McCPF69EvfT9opL7um99lSe8GTgbe7j98kKgn8/d7gf8BMKc8k+D5FG9y3FRzplGVY9ZXAOtsf6rloZuAd5X33wV8Y6KztWP7fNuzbA9Q9PX/tv124DbgreXTejI7gO0ngEclHV6ueh1wP33Q9xRDM8dJ2rv8GRrM3hd932Kkvr4JeGd5Ns1xwFMtQzk9Q9ICiiHKv7T9u5aHbgJOlfQCSbMp3iy+u46MO7Hd1zfgjRTvZv8UuKDuPB3k/ROKf0vXAPeWtzdSjGXfCjwEfA84oO6sbb6P1wI3l/dfTvHDvB64HnhB3flGyf0qYFXZ/18H9u+XvgcuBB4A1gJfAl7Qy30PXEPxfsEzFP89nTFSXwOiOCPup8B9FGcL9WL+9RRj7YO/u19oef4FZf4HgYV157edqQoiIpqq34doIiJiBCnwERENlQIfEdFQKfAREQ2VAh8R0VAp8BERDZUCHxHRUP8fWjJodpWqeF8AAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 3 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.subplot(311)\n",
    "plt.stem(x,markerfmt=' ')\n",
    "plt.ylim([0.5,3.5])\n",
    "plt.title('Original Signal')\n",
    "plt.subplot(312)\n",
    "plt.stem(y0,markerfmt=' ')\n",
    "plt.ylim([0.5,3.5])\n",
    "plt.ylabel('Phase0')\n",
    "plt.subplot(313)\n",
    "plt.stem(y1,markerfmt=' ')\n",
    "plt.ylim([0.5,3.5])\n",
    "plt.ylabel('Phase1')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如果您对两个上采样后的多相分量（相位 0 和相位 1）求和，将得到原始正弦波。"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "c8b08d2241c8157cc559a694afc7fe14d3ec73f4c204ededcfdcbff38dcf9d20"
  },
  "kernelspec": {
   "display_name": "Python 3.10.3 64-bit",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.3"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
